import { Button, ConfigProvider } from 'antd'
import { FC, useEffect, useState } from 'react'
import { Provider } from 'react-redux'
// import { useRequest } from 'ahooks'
import {
  HashRouter, HashRouter as Router, Route, Switch,
} from 'react-router-dom'
import zhCN from 'antd/es/locale/zh_CN'
import AppLayout from './views/AppLayout'
import AppLogin from './views/AppLogin'
import store from './store'
import AppRegister from './views/AppRegister'
// import { getFoodDetailApi } from './api/food'
const App: FC = () => {
  // const [_page, setPage] = useState(1)
  // const [_limit, setLimit] = useState(10)
  // const { data, loading, run: getFoodList } = useRequest(() => getFoodDetailApi(_page, _limit))
  // useEffect(() => {
  //   getFoodList()
  // }, [_page, _limit])
  // console.log('data', data)
  console.log('App')
  return (
    <Provider store={store}>
      <ConfigProvider locale={zhCN}>
        <Router>
          <Switch>
            <Route path="/login" component={AppLogin} />
            <Route path="/register" component={AppRegister} />
            <Route path="/" component={AppLayout} />
          </Switch>
        </Router>
      </ConfigProvider>
    </Provider>
  )
}
export default App
